exports.atobPolyfill = function(a) {
	for (var t, e, r = a.replace(/=+$/, ""), o = "", n = 0, f = 0; e = r.charAt(f++); ~e && (t = n % 4 ? 64 * t +
			e : e,
			n++ % 4) ? o += String.fromCharCode(255 & t >> (-2 * n & 6)) : 0) e =
		"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(e);
	return o;
}, exports.calculateSimpleInterestIRR = function(a) {
	var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1e-4,
		e = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 1e-6,
		r = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 1e3,
		o = t,
		n = 0,
		f = 1;

	function l(t) {
		for (var e = 0, r = 0; r < a.length; r++) e += a[r] / (1 + r * t);
		return e;
	}
	for (; Math.abs(f) > e && n < r;) {
		var i = l(o),
			h = (l(o + e) - i) / e;
		if (!(Math.abs(h) > 1e-10)) break;
		var d = o - i / h;
		f = d - o, o = d, n++;
	}
	return n === r && console.log("Warning: Max iterations reached without convergence"),
		o;
}, exports.calculateWeightInterestIRR = function(a) {
	for (var t = 0, e = 0, r = 0; r < a.length; r++) Number(a[r]) > 0 && (t += Number(a[r]),
		e += Number(a[r]) * r);
	var o = 1;
	t > 0 && (o = e / t);
	for (var n = 0, f = 0, l = 0; l < a.length; l++) Number(a[l]) < 0 && (n += Number(a[l]),
		f += Number(a[l]) * l);
	return -(t + n) / n / (o - f / n);
};